<%@ page import="entity.Emp" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: teacher
  Date: 2022/12/13
  Time: 17:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>员工列表</title>
</head>
<body>
<h1>员工列表</h1>
<a href="<%=request.getContextPath()%>/showAddEms">添加员工</a>
<hr>
<table border="1">
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>工资</th>
        <th>所属部门</th>
    </tr>
    <%
        List<Emp> emps = (List<Emp>) request.getAttribute("emps");
        if(!emps.isEmpty()){
            for(Emp emp : emps){
    %>
    <tr>
        <td><%=emp.getId()%></td>
        <td><%=emp.getName()%></td>
        <td><%=emp.getSalary()%></td>
        <td><%=emp.getDept().getName()%></td>
    </tr>
    <%
            }
        }
    %>
</table>
</body>
</html>
